<template>
  <div>
    <a-carousel v-if="lines.length >= 3" arrows :slidesToShow="3" :slidesToScroll="1" :dots="false">
      <template #prevArrow>
        <div class="custom-slick-arrow" style="left: 10px; z-index: 1">
          <left-circle-outlined />
        </div>
      </template>
      <template #nextArrow>
        <div class="custom-slick-arrow" style="right: 10px">
          <right-circle-outlined />
        </div>
      </template>
      <chartA :line="item" v-for="(item, index) in lines" :key="index" />
    </a-carousel>
    <ul v-else class="grid grid-cols-3 gap-4 mt-4">
      <li v-for="(item, index) in lines" :key="index">
        <chartA :line="item" />
      </li>
      <li v-for="item in 3 - lines.length" :key="item"></li>
    </ul>
  </div>
</template>

<script lang="ts">
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
import { defineComponent } from 'vue';
import chartA from './chart/a.vue';

export default defineComponent({
  props: ['lines'],
  components: {
    LeftCircleOutlined,
    RightCircleOutlined,
    chartA,
  },
});
</script>

  <style scoped>
/* For demo */
.ant-carousel :deep(.slick-slide) {
  text-align: center;
  height: 200px;
  overflow: hidden;
}

.ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: #fff;
  background-color: rgba(31, 45, 61, 0.11);
  opacity: 0.3;
  z-index: 1;
}
.ant-carousel :deep(.custom-slick-arrow:before) {
  display: none;
}
.ant-carousel :deep(.custom-slick-arrow:hover) {
  opacity: 0.5;
}

.ant-carousel :deep(.slick-slide h3) {
  color: #fff;
}
</style>
  